<include file="Public:header" />


<div class="autobox">
	<div class="now">
		<i class="fa fa-home fa-lg move mr5"></i><a href="/" class="">首页 </a>&gt; 注册账户	</div>
	<div class="login_step">
		<ul class="order clear">
			<li><i class="fa fa-circle  fz_40 move"><span>1</span></i> 用户注册				<div class="order_line"></div>
			</li>
			<li><i class="fa fa-circle  fz_40"><span>2</span></i>交易密码				<div class="order_line"></div>
			</li>
			<li><i class="fa fa-circle  fz_40"><span>3</span></i>实名认证				<div class="order_line"></div>
			</li>
			<li><i class="fa fa-circle  fz_40"><span>4</span></i>成功</li>
		</ul>
	</div>
	<div class="reg_box ">
		<div class="mt50">
			<div id="reg_index" class="reg_wrap">
				<div class="reg_input_box reg-fb" id="email_reg">
					<div class="reg_title">手机号：</div>
					<input type="text" id="mobles" class="texts" style="display: none;"> 
					<input type="text" id="moble" class="texts wh300 hg40" placeholder="请输入手机号码" onblur="check_moble()" style="padding-left: 40px;    width: 295px;"/>
					<link rel="stylesheet" href="/comfile/css/intlTelInput.css">
					<script src="/comfile/js/intlTelInput.js"></script>
					<script>
						$("#mobles").intlTelInput({
							autoHideDialCode: false,
							defaultCountry: "cn",
							nationalMode: false,
							preferredCountries: ['cn', 'us', 'hk', 'tw', 'mo'],
						});
					</script>
					<a class="move" onclick="new_sends()">点击发送验证码</a>
				</div>
				<div class="reg_input_box reg-fb">
					<div class="reg_title">验证码：</div>
					<input id="moble_verify" type="text" class="texts w300 hg40" placeholder="请输入验证码"> <span id="reg_moble" class="" style="position: absolute;
    left: 210px;top: 2px;"></span>
				</div>
				<div class="reg_input_box reg-fb">
					<div class="reg_title">密码：</div>
					<input type="password" id="password" class="texts w300 hg40" placeholder="请输入登陆密码" style="line-height: 34px;"/>
				</div>
				<div class="reg_input_box reg-fb">
					<div class="reg_title">邀请码：</div>
					<input id="invit" type="text" class="texts w300 hg40" placeholder="没有可不填" value=""/>
				</div>
				<div class="reg_radio_box">
					<label> <input type="checkbox" id="regweb" checked="checked" style="vertical-align: -2px;"> 注册即视为同意 <a href="javascript:void(0)" class="move" onclick="regWeb();">用户注册协议</a></label>
				</div>
				<div class="formbody">
					<input type="button" class="btns2 w300 hg40" onclick="reg_up();" value="立即注册">
				</div>
			</div>
		</div>
	</div>
</div>
<div class="all_mask_loginbox" id="step1" style="display: none;width:420px;">
	<div class="login_title pl20">验证手机</div>
	<form id="form-login" class="mask_wrap login-fb">
		<div class="login_text zin80">
			<div class="mask_wrap_title">图形验证码：</div>
			<input type="text" id="verify" value="" class="texts" style="width: 98px; box-shadow: none;"/>
			<span style="vertical-align: -14px;line-height: 20px;">
				<img id="verify_up" class="codeImg reloadverify" src="{:U('Verify/code')}" title="换一张" onclick="this.src=this.src+'?t='+Math.random()" width="100" height="34">
			</span>
		</div>
		<div class="login_text zin80">
			<div class="mask_wrap_title">获取验证码：</div>
						<input type="button" value="发送短信验证码" class="btns" onclick="moble_reg('sms')" style="width: 100px;font-size: 12px;"/>
								</div>
	</form>
	<div class="mask_wrap_close" onclick="showB()"><i class="fa fa-times fz_20 move" aria-hidden="true"></i></div>
</div>
<div id="step2" class="all_mask" style="height: 0px;display: none;"></div>
<script>
	$(function () {
		var height = $(document).height();
		if (height < 1000) {
			height = 1000;
		}
		$('#step2').height(height);
		$("#moble").focus();
	});
	function regWeb() {
		layer.open({
			type: 2,
			skin: 'layui-layer-rim', // 边框
			area: ['800px', '600px'], // 宽高
			title: '用户注册协议', // 标题
			content: "{:U('Login/webreg')}"
		});
	}
	function showB() {
		$("#step1").hide();
		$("#step2").hide();
		$("#verify").focus();
	}
	function check_moble() {
		var moble  = $('#moble').val();
		var mobles = $('#mobles').val();
		if (moble == "" || moble == null) {
			layer.tips("请输入手机号", '#moble', {tips: 2});
			return false;
		}
		$.post("/login/check_moble.html", {
			moble: moble,
			mobles: mobles,
			token: ""
		}, function (data) {
			if (data.status == 1) {
				$("#step1").show();
				$("#step2").show();
				$("#verify").focus();
				$('#reg_moble').html('<a class="move" onclick="new_send()">点击发送验证码</a>');
			} else {
				layer.tips(data.info, '#moble', {tips: 2});
				return false;
			}
		}, 'json');
	}
	function verify_ups() {
		$('#verify_up').attr('src', "/ajax/verify.html?t=" + Math.random());
	}
	function new_send() {
		$("#step1").show();
		$("#step2").show();
		$("#verify").focus();
	}
	function new_sends() {
		var moble  = $('#moble').val();
		var mobles = $('#mobles').val();
		if (moble == "" || moble == null) {
			layer.tips("请输入手机号", '#moble', {tips: 2});
			return false;
		}
		$.post("/login/check_moble.html", {
			moble: moble,
			mobles: mobles,
			token: ""
		}, function (data) {
			if (data.status == 1) {
				$("#step1").show();
				$("#step2").show();
				$("#verify").focus();
			} else {
				layer.tips(data.info, '#moble', {tips: 2});
				return false;
			}
		}, 'json');
	}
	function moble_reg(type) {
		var moble  = $("#moble").val();
		var mobles = $("#mobles").val();
		var verify = $("#verify").val();
		if (moble == "" || moble == null) {
			layer.tips("请输入手机号码", '#moble', {tips: 2});
			return false;
		}
		if (verify == "" || verify == null) {
			layer.tips("请输入图形验证码", '#verify', {tips: 2});
			return false;
		}
		$.post("/login/real.html", {
			moble: moble,
			mobles: mobles,
			type: type,
			verify: verify,
			token: ""
		}, function (data) {
			if (data.status == 1) {
				layer.msg(data.info, {icon: 1});
				$("#step1").hide();
				$("#step2").hide();
				$("#moble_verify").focus();
				$('#moble').attr("disabled", "disabled");
				$('#mobles').attr("disabled", "disabled");
				var obj      = $('#reg_moble');
				var wait     = 60;
				var interval = setInterval(function () {
					obj.html("<a>" + wait + "秒可再次发送" + "</a>");
					wait--;
					if (wait < 0) {
						clearInterval(interval);
						$(".reloadverify").click();
						$("#verify").val('');
						obj.html('<a class="move" onclick="new_send()">点击重新发送</a>');
					}
					;
				}, 1000);
			} else {
				$(".reloadverify").click();
				layer.msg(data.info, {icon: 2});
				if (data.url) {
					window.location = data.url;
				}
			}
		}, "json");
	}
	function reg_up() {
		var moble        = $("#moble").val();
		var mobles       = $("#mobles").val();
		var moble_verify = $("#moble_verify").val();
		var password     = $("#password").val();
		var invit        = $("#invit").val();
		if (moble == "" || moble == null) {
			layer.tips("请输入手机号", '#moble', {tips: 2});
			return false;
		}
		if (moble_verify == "" || moble_verify == null) {
			layer.tips("请输入验证码", '#moble_verify', {tips: 2});
			return false;
		}
		if (password == "" || password == null) {
			layer.tips("请输入密码", '#password', {tips: 2});
			return false;
		}
		if (!$("#regweb").is(':checked')) {
			layer.tips("请勾选用户注册协议", '#regweb', {tips: 3});
			return false;
		}
		$.post("/login/upregister.html", {
			moble: moble,
			mobles: mobles,
			moble_verify: moble_verify,
			password: password,
			invit: invit,
			token: ""
		}, function (data) {
			if (data.status == 1) {
				layer.msg(data.info, {icon: 1});
				$.cookies.set('move_moble', moble);
				$.cookies.set('move_mobles', mobles);
					window.location = '/Login/paypassword';
			} else {
				layer.msg(data.info, {icon: 2});
				if (data.url) {
					window.location = data.url;
				}
			}
		}, "json");
	}
</script>









<include file="Public:footer" />